#!/bin/bash

# ***************************************************************************
# * 
# * @file:build_vim.sh 
# * @author:ebayboy@163.com 
# * @date:2019-11-28 19:28 
# * @version 1.0  
# * @description: Shell script 
# * @Copyright (c)  all right reserved 
#* 
#**************************************************************************/ 


# yum install python-devel
#or will get vim -python

function config_vim()
{
	mv /usr/bin/vim /usr/bin/vim.old

	ln -s /usr/local/vim/bin/vim /usr/bin/vim
	ln -s /usr/local/vim/bin/xxd  /usr/bin/.
	ln -s /usr/local/vim/bin/vimtutor  /usr/bin/.  

	echo "config vim..."
}

function build_vim()
{
	rm -rf /usr/local/vim
	make uninstall 
	make clean

	./configure --prefix=/usr/local/vim \
		--with-features=huge \
		--enable-multibyte \
		--enable-largefile \
		--enable-pythoninterp=yes \
		--enable-python3interp=yes \
		--with-python-command=/usr/bin/python2.6 \
		--with-python3-command=/usr/local/python3/bin/python3 \
		--enable-luainterp=yes \
		--enable-cscope \
		--enable-terminal \
		--enable-autoservername || exit 1
	
	make || exit 1
	make install || exit 1
}

build_vim;

config_vim;

exit 0

